package org.judking.CarKeeper.command;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

public class ObdCommandCache implements Serializable {
	public static int maxCapacity = 10;
	private List<Object> cache;
			
	
	//-----------------------------------------------constructor---------------------------------------------------------//
	public ObdCommandCache()			{
		cache = new ArrayList<Object>();
	}
	
	
	//-----------------------------------------------method---------------------------------------------------------//
	public void addInCache(Object obj)				{
		if(cache.size() == maxCapacity)			{
			cache.remove(0);
		}
		cache.add(obj);
	}
	
	public List<Object> getCache()					{
		return cache;
	}
	
	public int getSize()			{
		return cache.size();
	}
	
	public Object getItem(int position)		{
		return cache.get(position);
	}
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 130227L;
}
